#ifndef USER_GlOBAL_H
#define USER_GlOBAL_H
//user_global defines ()
#include "gd32f4xx.h"
#include<math.h>
//user_def
#define XDATA __attribute__((section("XRAM")))
#define IDATA __attribute__((section("IRAM2")))

typedef unsigned char    U8;
typedef unsigned short    U16;
typedef unsigned long    U32;


#ifndef   bit
  #define bit  unsigned char
#endif
#ifndef   uchar
  #define uchar  unsigned char
#endif
#ifndef   ushort
  #define ushort unsigned short
#endif
#ifndef   ulong
  #define ulong unsigned long
#endif
#ifndef   uint
  #define uint unsigned long
#endif

#define MSB        1
#define LSB        0
  
typedef union tagUU16
{
    U8 UU8[2];
    U16 UU16;
} UU16;

//将多字节数转换为小端模式
U16 from_little_endian_16(U16 n);
//将多字节数转换为小端模式
U32 from_little_endian_32(U32 n);

// 使用UART1
//#define _USES_UART1
// UART1通讯最大尝试次数
#define UART1_MAX_RETRY_TIMES        5


// 通讯波特率
#define BAUDRATE                    115200


#define STATUS_IDLE                     0
#define STATUS_BUSY                     0xFFFF
#define STATUS_S_HOME_SENSOR_ERROR      1



#endif // CONFIG_H
